import 'package:flutter/material.dart';

class MenuItem {
  String title; //标题
  String? path; //路径
  MenuItem({
    required this.title,
  });
}

// ignore: must_be_immutable
class MovieMenu extends StatelessWidget {
  List<MenuItem> menuList = [
    MenuItem(title: '找片看'),
    MenuItem(title: '片单'),
    MenuItem(title: '电影'),
    MenuItem(title: '电视剧'),
    MenuItem(title: '纪录片'),
    MenuItem(title: '综艺'),
    MenuItem(title: '短剧'),
    MenuItem(title: '我的追剧'),
  ];
  MovieMenu({super.key});
  @override
  Widget build(BuildContext context) {
    return SliverToBoxAdapter(
      child: Container(
        height: 56,
        padding: const EdgeInsets.only(top: 12, bottom: 10),
        decoration: const BoxDecoration(color: Color(0xfffffffd)),
        child: ListView.builder(
          scrollDirection: Axis.horizontal,
          itemCount: menuList.length,
          itemBuilder: (BuildContext context, int index) {
            return Container(
              padding: const EdgeInsets.only(left: 11, right: 11),
              margin: EdgeInsets.only(
                right: index == menuList.length - 1 ? 12 : 9,
                left: index == 0 ? 12 : 0,
              ),
              decoration: BoxDecoration(
                // color: Colors.white,
                color: const Color(0xffeff2f1), //#eff2f1
                borderRadius: BorderRadius.circular(6),
              ),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  Text(
                    menuList[index].title,
                    style: const TextStyle(
                      fontSize: 13,
                      color: Color(0xff1c1c1c),
                    ),
                  )
                ],
              ),
            );
          },
        ),
      ),
    );
  }
}
